package mc.support.taobao.api;

import com.taobao.api.TaobaoRequest;
import com.taobao.api.request.ItemUpdateRequest;
import com.taobao.api.response.ItemUpdateResponse;

import java.util.Date;

/**
 * Created with IntelliJ IDEA. <br/>
 * Author: francis Yun    <br/>
 * Date: 2013-11-26  <br/>
 */
public class UpdateItemReq extends AbstractReq<UpdateItemReq, ItemUpdateResponse> {

    private Long numIid;
    private Date listTime;
    private String title;
    private String sellPoint;
    private Long postageId;
    private String outerdId;
    private String price;
    private Boolean hasInvoice;
    private Boolean hasWarranty;
    private Long num;


    public UpdateItemReq numId( Long numIid ) {
        this.numIid = numIid;
        return this;
    }

    public UpdateItemReq listTime( Date listTime ) {
        this.listTime = listTime;
        return this;
    }

    public UpdateItemReq title( String title ) {
        this.title = title;
        return this;
    }

    public UpdateItemReq price( String price ) {
        this.price = price;
        return this;
    }

    public UpdateItemReq sellPoint( String sellPoint ) {
        this.sellPoint = sellPoint;
        return this;
    }

    public UpdateItemReq postageId( Long postageId ) {
        this.postageId = postageId;
        return this;
    }

    public UpdateItemReq outerdId( String outerdId ) {
        this.outerdId = outerdId;
        return this;
    }

    public UpdateItemReq hasInvoice( Boolean hasInvoice ) {
        this.hasInvoice = hasInvoice;
        return this;
    }

    public UpdateItemReq hasWarranty( Boolean hasWarranty ) {
        this.hasWarranty = hasWarranty;
        return this;
    }

    public UpdateItemReq num( Long num ) {
        this.num = num;
        return this;
    }

    @Override
    protected TaobaoRequest toRequest() {
        ItemUpdateRequest req = new ItemUpdateRequest();

        if ( null != numIid ) {
            req.setNumIid( numIid );
        }

        if ( null != listTime ) {
            req.setListTime( listTime );
        }

        if ( null != title ) {
            req.setTitle( title );
        }

        if ( null != sellPoint ) {
            req.setSellPoint( sellPoint );
        }

        if ( null != postageId ) {
            req.setPostageId( postageId );
        }

        if ( null != outerdId ) {
            req.setOuterId( outerdId );
        }

        if ( null != hasInvoice ) {
            req.setHasInvoice( hasInvoice );
        }

        if ( null != hasWarranty ) {
            req.setHasWarranty( hasWarranty );
        }

        if ( null != price ) {
            req.setPrice( price );
        }

        if ( null != num ) {
            req.setNum( num );
        }

        return req;
    }

}
